<!-- 浙政钉 一层立模 v2 -->
<template>
  <div class="oneLayerForm">
    <div class="CUNYUSHEN">
      <tabForm v-if="rowData.ROW_GUID" :rowData="rowData" name="一层立模">
        <van-collapse v-model="activeNames1">
          <p class="subTitle"><span class="line"></span> <span style="color: #3f8ffc">住房施工过程检查记录单</span></p>
          <van-collapse-item title="住房施工过程检查记录单" name="0">
            <van-field required name="picker" :value="JFData[0]['JFXZ']" label="立模验收层数" placeholder="请选择" @click="Enum.show = true"
              clickable readonly>
              <template #button>
                <van-button size="small" type="info" @click.stop="getSelection()">填写记录单</van-button>
              </template>
            </van-field>
            <van-popup v-model="Enum.show" position="bottom">
              <van-picker value-key="name" show-toolbar :columns="Enum.isArr" @confirm="onConfirm"
                @cancel="Enum.show = false" />
            </van-popup>
          </van-collapse-item>
        </van-collapse>
        <!-- <inputSelect :isShowCity="false" :contentData.sync="fYjldData" :JFData.sync="JFData" :title="''"
          @getValues="getValues" @getButton1="getButton1" /> -->
      </tabForm>
      <van-dialog v-model="show" title="新增" show-cancel-button>
        <div style="max-height: 60vh;overflow: auto;">
          <inputSelect :isShowCity="false" :contentData.sync="dialogData" :JFData.sync="JFData" :title="'立模住房施工过程检查记录单'"
            @getValues="getValues" @getButton1="getButton1" />
        </div>
      </van-dialog>
    </div>
    <div class="footer">
      <van-button style="width: 30vw" size="small" type="info">保存</van-button>
      <van-button style="width: 30vw" size="small" type="info">提交</van-button>
      <van-button style="width: 30vw" size="small" type="info">退回</van-button>
    </div>
  </div>
</template>

<script>
import tabForm from './children/tabForm.vue'
import inputSelect from '../public/inputSelect'
import upLoad from '@/utils/upLoad'
import { GSA_Search } from '@/common/commonApi'
export default {
  data() {
    return {
      active: 0,
      show: false,
      show2: false,
      radio: "",
      rowData: {},
      activeNames1: ["0"],
      JFData: [
        {
          XCSJ1: '1111',
          XCSJ2: '122',
          XCSJ3: '2020-02-02',
          XCSJ4: '1222',
          CWSHR: '系统管理员',
          ZGSHR: '2020-02-02',
          ZGSHYJ: ''
        }
      ],
      dialogData: [
        {
          label: '立模验收层数',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '施工单位(建筑工匠)',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: false, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '立模宅基地面积(㎡)',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '立模房基占地面积(㎡)',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '立模是否通过',
          key: 'XCSJ1', //绑定的字段
          ISinput: false, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false, //true:可以时间选择器 false：下拉框
          emitData: '2c478392-9c1b-40da-b941-41e4b8c9d6d3',
          NYDARR: []
        },
        {
          label: '检查时间',
          key: 'XCSJ1', //绑定的字段
          ISinput: false, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: true //true:可以时间选择器 false：下拉框
        },
        {
          label: '检查人员',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '参与人员',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: false, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '发现问题及处理意见',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: true, //true: 必填项
          types: 'textarea',
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
        {
          label: '验收意见',
          key: 'XCSJ1', //绑定的字段
          ISinput: true, //true:输入框
          required: true, //true: 必填项
          types: 'textarea',
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false //true:可以时间选择器 false：下拉框
        },
      ],
      Enum: {
        isArr: [
          {
            "value": 731,
            "name": "一层",
          },
          {
            "value": 733,
            "name": "二层",
          },
          {
            "value": 753,
            "name": "三层",
          }
        ],
        show: false,
      },
    }
  },
  filters: {
    inUseName: function (msg, data) {
      let name = ''
      data.forEach((item) => {
        if (item.value == msg) {
          name = item.name
        }
      })
      return name
    },
  },
  methods: {
    getValues(name, value, label) {
      console.log(name, value, label, this.JFData)
    },
    onConfirm(val) {
      this.Enum.show = false
    },
    async getButton1(data) {
      console.log(data)
    },
    async getSelection() {
      let data = [{ field: 'PKID', value: this.rowData.PKID }]
      const res = await GSA_Search('13d9cd3f-5eb3-49e3-aceb-fa345fab81a5', data)
      console.log(res)
      if (res.Data && res.Data.length > 0) {
        this.show2 = true
        // this.cjdwData = res.Data
      }
      this.show = true
    }
  },
  mounted() {
    this.rowData = JSON.parse(this.$route.query.data)
  },
  created() { },
  components: {
    inputSelect,
    upLoad,
    tabForm
  }
}
</script>

<style lang="scss" scoped>
.oneLayerForm {
  height: 100vh;

  .CUNYUSHEN {
    height: 93vh;
    padding: 4px;
    overflow: auto;
  }

  .footer {
    height: 6vh;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .subTitle {
    width: 100%;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #9b9b9b;
    padding-left: 10px;

    .line {
      width: 6px;
      height: 26px;
      background: #3f8ffc;
      display: inline-block;
      margin-right: 10px;
    }
  }
}
</style>

<style>
.van-cell {
  color: black;
  font-weight: bold !important;
}

.van-collapse-item__content {
  color: black;
  padding: 0 6px !important;
}
</style>
